package com.longshine.arthmetic.haff;

public class HuffCode {

	static int MAX_NUM = 1000;
	public static void main(String[] args){
		
	}
	public static Huff[] toHaffArray(int[] arr){
		int m1 = MAX_NUM;
		int m2 = MAX_NUM;
		Huff[] h = new Huff[arr.length];
		int k = 0;
		for(int i = 0;i<arr.length;i++){
			if(arr[i]<m1&&arr[i]>0){
				m1 = arr[i];
				arr[i] = -1;
			}
			else if(arr[i]<m2&&arr[i]>0){
				m2 = arr[i];
				arr[i] = -1;
			}
		}
		if(m1 != MAX_NUM){
			h[k] = new Huff();
//			h[k].left
			
		}
		if(m2 != MAX_NUM){
			
		}
		
		return null;
	}
	public static Node[] toNodeArr(int[] data){
		int l = data.length;
		int len = 2*l-1;
		Node arr[] = new Node[len];
		for(int i = 0;i<l;i++){
			arr[i].left = -1;
			arr[i].right = -1;
			arr[i].weight = data[i];
		}
		return arr;
	}
}
